<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--       
*     Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
*     Use is subject to license terms.
-->
<html>
<head>
	<title>Move a Class</title>
<link href="nbdocs:/org/netbeans/modules/usersguide/ide.css"  rel="stylesheet" type="text/css">
</head>
<body>
<h2>Move a Class</h2>
<p> <small><a href="#seealso">See Also</a></small> 


<p>You can move a class to another package and change all references to the class in its new location.. 
<p><b>To move a class and change the code that references that class: </b></p>
<ol>
  <li>In the Projects window or Source editor, right-click the class and choose Refactor > Move  from the  contextual menu.</li>
  <li>In the Move Class dialog box, select the package from the To Package combo box or type the fully qualified package name.  </li>
  <li>To apply the changes to the code, do one of the following:
    <ul>
  <li>Click  the Refactor button. <br>
      The IDE instantly applies all the changes. 
  <li>Click the Preview button. <br>
      The Refactoring window displays all lines of code that will be changed. Review the changes and clear the checkbox for any code that you do not want to change. Click the Do Refactoring button to apply the changes. </li>
</ul>
</ol>
<ul class="note">
		<li>You can also initiate the moving of a class by dragging the class's node in the Project's window to another package or by cutting and pasting the class's node.</li> </ul>

<p><b>To move a class without doing refactoring: </b></p>
<ol>
<li>In the Projects window, manually move the class to another package.<br>
You can cut and paste the class, or you can use drag and drop.</li>        
<li>In the Move Class dialog box, select the Move Without Refactoring checkbox.</li>
<li>Click Next.</li>
</ol>

<ul class="note">
<li>You should always perform a clean build after completing any refactoring commands. To perform a clean build,  right-click the project's node in the Projects window and choose Clean and Build Project.</li> </ul>

<dl>
<dt><a name="seealso">See Also</a></dt>
<dd><a href="rename_class.html">Rename a Class </a></dd>
<dd><a href="undo_refactor_changes.html">Undoing Refactoring Changes </a></dd>
</dl>

<hr>
<p><font size=-2><a href="../credits.html">Legal Notices</a></font>
</p>
<table cellpadding="50" border="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

</body>
</html>
